@extends('admin._layouts.default')

@section('main')

      <ol class="breadcrumb">
        <li><a href="login-index.html">首页</a></li>
        <li><a href="#">功能</a></li>
        <li><a href="Reply.html">关键字回复</a></li>
        <li class="active">添加</li>
      </ol>
    <div class="tab-content has-weixinpreivew">
            <!-- 表单 -->

    {{ Form::open(array('route' => 'admin.menus.store','id'=>'menu_form')) }}              <!-- 基础文档模型 -->
              <div id="tab1" class="tab-pane in tab1">
                      <div class="form-item cf toggle-sort">
                        <label class="item-label">排序号
                            <span class="check-tips">
                            （数值越小越靠前）
                              </span></label>
                        <div class="controls">
                          <input type="number" class="text input-medium" name="sort" value="0">                    </div>
                      </div>                <div class="form-item cf toggle-pid">
                        <label class="item-label">
                                            一级菜单
                               <span class="check-tips">

                          （如果是一级菜单，选择“无”即可）                      </span></label>
                        <div class="controls">
                          <select name="pid">
                                <option value="0" class="toggle-data" toggle-data="" selected="">无</option>
                                @foreach($mymenus as $menu)
                                <option value="{{ $menu->id }}" class="toggle-data" toggle-data="">{{ $menu->title }}</option>
                                @endforeach
                          </select>
                      </div>
                      </div>                <div class="form-item cf toggle-title">
                        <label class="item-label">
                        <span class="need_flag">*</span>                    菜单名                    <span class="check-tips">
                          （可创建最多 3 个一级菜单，每个一级菜单下可创建最多 5 个二级菜单。编辑中的菜单不会马上被用户看到，请放心调试。）                      </span></label>
                        <div class="controls">
                          <input type="text" class="text input-large" name="title" value="">                    </div>
                      </div>                <div class="form-item cf toggle-keyword">
                        <label class="item-label">
                                            关联关键词                    <span class="check-tips">
                          （关联关键词和关联URL选填一项）                      </span></label>
                        <div class="controls">
                          <input type="text" class="text input-large" name="keyword" value="">                    </div>
                      </div>                <div class="form-item cf toggle-url">
                        <label class="item-label">
                                            关联URL                    <span class="check-tips">
                                                </span></label>
                        <div class="controls">
                          <input type="text" class="text input-large" name="url" value="">                    </div>
                      </div>                          <div class="form-item cf">
                <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
                 </div>


            </div>
    {{ Form::close() }}
            <!--通用的微信预览模板-->
    <!--头部标题栏-->
    <!--鉴于样式title放进具体每块模块-->
    <!--CSS模块-->
    <div class="weixin-preview" style="display: none;">
    	<p class="preview-tips">微信回复预览</p>
    	<div class="weixin-box">
    	<p class="weixin-title"></p>
        <div class="weixin-cover"><img class="weixin-cover-pic" src="/Public/Home/images/no_cover.png"></div>
        <p class="weixin-content">

        </p>
    </div>
    <script type="text/javascript">
    $('.tab-content').addClass('has-weixinpreivew');
    if($('input[name="title"]').val()!=undefined){
    	$('.weixin-title').html($('input[name="title"]').val());
    }else{
    	$('.weixin-title').html($('input[name="config[title]"]').val());
    }
    if($('textarea[name="content"]').val()!=undefined){
    	$('.weixin-content').html($('textarea[name="content"]').val());
    }else if($('textarea[name="intro"]').val()!=undefined){
    	$('.weixin-content').html($('textarea[name="config[intro]"]').val());
    	}else{
    	$('.weixin-content').html($('textarea[name="config[info]"]').val());
    }
    var weixin_cover_picurl = $('#cover_id_picurl').next().find('img').attr('src');
    if(weixin_cover_picurl==undefined)weixin_cover_picurl=$('#cover_id_cover').next().find('img').attr('src');
    if($('#cover_id_cover').val()==undefined && $('#cover_id_picurl').val()==undefined){
    	$('.weixin-preview').hide();
    	}
    if(weixin_cover_picurl==undefined || weixin_cover_picurl==""){
    	$('.weixin-cover-pic').attr('src',"/Public/Home/images/no_cover.png");
    }else{
    	$('.weixin-cover-pic').attr('src',weixin_cover_picurl);
    }
    $('input[name="title"]').keyup(function(){
    	$('.weixin-title').html($(this).val());
    	});
    $('textarea[name="content"]').keyup(function(){
    	$('.weixin-content').html($(this).val());
    	});
    $('textarea[name="info"]').keyup(function(){
    	$('.weixin-content').html($(this).val());
    	});
    $('textarea[name="intro"]').keyup(function(){
    	$('.weixin-content').html($(this).val());
    	});
    </script>
          </div>
        </div>

@stop


@section('modals')

<div id="confirm_alert" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 class="modal-title" id="myModalLabel">确定本次操作吗？</h3>
      </div>
      <div class="modal-body">
        <i class=" icon-warning-sign color_red pull-left fs_24"></i>

        <p>一旦【确定】，本次操作不可撤销。</p>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary">确定</button>
      </div>
    </div>
  </div>
</div>
@stop